home *** CD-ROM | disk | FTP | other *** search
-
- #define NOCOMM
- #include <windows.h>
- #include <memory.h>
-
- #include "hugearr.h"
-
- /* Set a huge array element. */
- /* VBM: Declare Function VBHugeSet% Lib "hugearr.dll" Alias "VBHugeSet" (ByVal Index%, ByVal el&, buffer As Any) */
- int FAR PASCAL
- VBHugeSet(int hArray, long element, LPBYTE buffer)
- {
- HPBYTE ptr; /* pointer to array element */
- PHUGEDESC pArray; /* pointer to array descriptor */
-
- DecCheckHandle(hArray);
-
- /* point to proper descriptor */
- pArray = (PHUGEDESC) LocalLock(hLocalMem) + hArray;
-
- CheckNotAllocYet(pArray);
- CheckSubscript(pArray, element, element);
-
- /* calculate pointer to element */
- ptr = (HPBYTE) GlobalLock(pArray -> handle);
-
- /* add offset of element */
- ptr += HugeElementOffset(element, pArray->perseg, pArray->recsize);
-
- /* copy data */
- _fmemcpy(ptr, buffer, pArray -> recsize);
-
- GlobalUnlock(pArray -> handle);
- LocalUnlock(hLocalMem);
- return HA_OK;
- }
-